/**
 * 
 */
package org.codesketch.birch.common;

/**
 * Exposes useful common method to deal with strings
 * @author Quirino Brizi
 *
 */
public final class StringUtils {
	// avoid class instantiation
	private StringUtils() {}
	
	/**
	 * Verify the given string is empty (null or no characters).
	 * @param arg the string to have to check
	 * @return true if the argument is empty, false otherwise
	 */
	public static boolean empty(
			final String arg) {
		
		return null==arg || "".equals(arg);
	}
	/**
	 * Verify all the given strings are empty (null or no characters).
	 * @param args the strings to have to check
	 * @return true if all the arguments are empty, false otherwise
	 */
	public static boolean empty(
			final String ... args) {
		
		boolean empty = true;
		for (String arg : args) {
			empty &= empty(arg);
		}
		return empty;
	}
	/**
	 * Put the first letter of the given argument upper case if not.
	 * @param arg the string to capitalise
	 * @return the capitalised as a new string
	 */
	public static String capitalise(
			final String arg) {
		
		char[] chars = arg.toCharArray();
		chars[0] = Character.toUpperCase(chars[0]);
		return new String(chars);
	}
}
